<?php 
$sesAdm =  $_SESSION['adminlogin'];

echo $objFungsi->buatJudul('Profil');
 ?>
 <form name="frmMyUseradmin" method="POST" action="#">
	<input type="hidden" value="<?php echo $sesAdm['id']; ?>" name="id">
	<input type="hidden" value="1" name="myp">
	<table>
		<tr>
			<td>Nama</td>

			<td><input name="nama" 
				class="text_box_3" 
				placeholder="Nama" 
				required="required" value="<?php echo $sesAdm['nama']; ?>" /></td>
		</tr>
		<tr>
			<td>Alamat</td>
			<td><textarea 
					name="alamat" 
					class="text_box_3" 
					placeholder="Alamat" 
					><?php echo $sesAdm['alamat'] ?></textarea></td>
		</tr>
		<tr>
			<td>Tanggal Lahir</td>
			<td><input name="lahir" 
				class="text_box_3"  value="<?php echo  $sesAdm['lahir']; ?>"
				placeholder="Format (YYYY-MM-DD)"/></td>
		</tr>
		<tr>
			<td>Email</td>
			<td><input name="email" 
					class="text_box_3"
					type="email" 
					value="<?php echo $sesAdm['email'] ?>"
					placeholder="Email" 
					required="required" /></td>
		</tr>
		<tr>
			<td>Username</td>
			<td><input name="username" 
				value="<?php echo $sesAdm['username'] ?>"
					class="text_box_3" 
					placeholder="Username" 
					required="required" /></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit" value="Simpan" /><input type="reset" value="Reset" /> </td>
		</tr>
	</table>

</form>


<script type="text/javascript">
	$(document).ready(function(){
		var frmUser = $(document).find('form[name="frmMyUseradmin"]');
		frmUser.submit(function(e){
			$.ajax({
				url:baseUrl+"proses/administrasi.php?on=simpan",
				data:frmUser.serialize(),
				type:'POST',
				dataType:'JSON',
				success:function(e){
					if(e.success==false){
						alert(e.error_msg);
					}
					else{
						document.location = document.URL;
					}

				},
				error:function(ed){
					alert('Gagal Menyimpan User');
				}
			});
			//alert(frmUser.attr('action'));
			e.preventDefault();
		});
	});
</script>